package cn.kgc.service;

import cn.kgc.entity.Users;
import io.seata.rm.tcc.api.BusinessActionContext;
import io.seata.rm.tcc.api.BusinessActionContextParameter;
import io.seata.rm.tcc.api.LocalTCC;
import io.seata.rm.tcc.api.TwoPhaseBusinessAction;

/**
 * @author wangyue
 * @version 1.0
 */
@LocalTCC
public interface UsersTccService {
    @TwoPhaseBusinessAction(
            //try操作的名称,全局唯一
            name="registerUser",
            //commit方法
            commitMethod = "commitRegisterUser",
            //rollback方法
            rollbackMethod = "rollbackRegisterUser"
    )
    Users registerUser(
            BusinessActionContext actionContext,
            @BusinessActionContextParameter(paramName = "mobile") String mobile
    );

    boolean commitRegisterUser(BusinessActionContext actionContext);

    boolean rollbackRegisterUser(BusinessActionContext actionContext);
}
